import { ThemeConfig } from '@/configs/theme';
import { SESSION_THEME_INFO } from '@/constants';

export function getThemeConfig() {
  // 先从localStorage里获取主题配置
  const themeItem = window.localStorage.getItem(SESSION_THEME_INFO);
  const sessionTheme = JSON.parse(themeItem ?? '{}');

  // 如果localStorage里没有主题配置，则使用globalConfig里的初始化配置
  const initTheme = sessionTheme ?? ThemeConfig;

  return initTheme;
}
